using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class GroupPropertyNames
  {
    public const string UserId = @"UserId"; 

    public const string UserName = @"UserName"; 

    public const string Password = @"Password"; 

  }

  public static class GroupReferenceNames
  {
    public const string Users = @"Users"; 

    public const string Roles = @"Roles"; 

    public const string Groups = @"Groups"; 

    public const string CreatedSubjects = @"CreatedSubjects"; 

    public const string EditedSubjects = @"EditedSubjects"; 

  }

  [Serializable]
  public partial class GroupLoadSettings : UserLoadSettings
  {

    public GroupLoadSettings()
    {
      OnCreate();
    }

    public new GroupFilterExpression Filter 
    { 
      get 
      { 
        base.Filter = GroupFilterExpression.FromUserFilterExpression(base.Filter);
        return base.Filter as GroupFilterExpression;
      }
      set { base.Filter = value; }
    }

    public GroupSelectionSettings Selection 
    { 
      get 
      { 
        base.Selection = GroupSelectionSettings.FromUserSelectionSettings(base.Selection);
        return base.Selection as GroupSelectionSettings;
      }
      set { base.Selection = value; }
    }

    public GroupInclusionSettings Inclusion 
    { 
      get 
      { 
        base.Inclusion = GroupInclusionSettings.FromUserInclusionSettings(base.Inclusion);
        return base.Inclusion as GroupInclusionSettings;
      }
      set { base.Inclusion = value; }
    }

    public GroupSortingSettings Sorting 
    { 
      get 
      { 
        base.Sorting = GroupSortingSettings.FromUserSortingSettings(base.Sorting);
        return base.Sorting as GroupSortingSettings;
      }
      set { base.Sorting = value; }
    }

    partial void OnCreate();

    public static new GroupLoadSettings FromUserLoadSettings(UserLoadSettings other)
    {
      if (other is GroupLoadSettings) return other as GroupLoadSettings;
      var result = new GroupLoadSettings();
      result.CopyFrom(other);
      return result;
    }

    public static GroupLoadSettings FromGroupLoadSettings(GroupLoadSettings other)
    {
      if (other != null) return other;
      var result = new GroupLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class GroupFilterExpression : UserFilterExpression 
  {
    partial void OnCreate();

    protected override void CopyFrom(UserFilterExpression other)
    {
      base.CopyFrom(other);
      if (other is GroupFilterExpression)
      {
        var item = (GroupFilterExpression)other;
      }
    }

    public static new GroupFilterExpression FromUserFilterExpression(UserFilterExpression other)
    {
      if (other is GroupFilterExpression) return other as GroupFilterExpression;
      var result = new GroupFilterExpression();
      result.CopyFrom(other);
      return result;
    }

    public static GroupFilterExpression FromGroupFilterExpression(GroupFilterExpression other)
    {
      if (other != null) return other;
      var result = new GroupFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class GroupSelectionSettings : UserSelectionSettings 
  {
    public GroupSelectionSettings()
    {

      OnCreate();
    }

    partial void OnCreate();

    protected override void CopyFrom(UserSelectionSettings other)
    {
      base.CopyFrom(other);
      if (other is GroupSelectionSettings)
      {
        var item = (GroupSelectionSettings)other;
      }
    }

    public static new GroupSelectionSettings FromUserSelectionSettings(UserSelectionSettings other)
    {
      if (other is GroupSelectionSettings) return other as GroupSelectionSettings;
      var result = new GroupSelectionSettings();
      result.CopyFrom(other);
      return result;
    }

    public static GroupSelectionSettings FromGroupSelectionSettings(GroupSelectionSettings other)
    {
      if (other != null) return other;
      var result = new GroupSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class GroupInclusionSettings : UserInclusionSettings 
  {
    public GroupInclusionSettings()
    {
      OnCreate();
    }

    public bool IncludeUsers { get; set; }
    private UserLoadSettings includedUsersSettings;
    public UserLoadSettings IncludedUsersSettings 
    { 
      get
      {
        includedUsersSettings = UserLoadSettings.FromUserLoadSettings(includedUsersSettings);
        return includedUsersSettings;
      } 
      set
      {
        includedUsersSettings = value;
      }
    }


    partial void OnCreate();

    protected override void CopyFrom(UserInclusionSettings other)
    {
      base.CopyFrom(other);
      if (other is GroupInclusionSettings)
      {
        var item = (GroupInclusionSettings)other;
        IncludeUsers = item.IncludeUsers;
        includedUsersSettings = item.includedUsersSettings;
      }
    }

    public static new GroupInclusionSettings FromUserInclusionSettings(UserInclusionSettings other)
    {
      if (other is GroupInclusionSettings) return other as GroupInclusionSettings;
      var result = new GroupInclusionSettings();
      result.CopyFrom(other);
      return result;
    }

    public static GroupInclusionSettings FromGroupInclusionSettings(GroupInclusionSettings other)
    {
      if (other != null) return other;
      var result = new GroupInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class GroupSortingSettings : UserSortingSettings 
  {
    public GroupSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected override void CopyFrom(UserSortingSettings other)
    {
      base.CopyFrom(other);
      if (other is GroupSortingSettings)
      {
        var item = (GroupSortingSettings)other;
      }
    }

    public static new GroupSortingSettings FromUserSortingSettings(UserSortingSettings other)
    {
      if (other is GroupSortingSettings) return other as GroupSortingSettings;
      var result = new GroupSortingSettings();
      result.CopyFrom(other);
      return result;
    }

    public static GroupSortingSettings FromGroupSortingSettings(GroupSortingSettings other)
    {
      if (other != null) return other;
      var result = new GroupSortingSettings();
      return result;
    }

  }
}
